﻿@model Medart.Models.DoctorNamesCollection
@{
    ViewBag.Title = "الرئيسيه";
}

@{
    
    if (ViewData["todayFullTotal"] == null)
    {
        ViewData["todayFullTotal"] = 0.0;
    }
    if (ViewData["yesterdayFullTotal"] == null)
    {
        ViewData["yesterdayFullTotal"] = 0.0;
    }
    if (ViewData["yesterdayRealTotal"] == null)
    {
        ViewData["yesterdayRealTotal"] = 0.0;
    }
    if (ViewData["todayRealTotal"] == null)
    {
        ViewData["todayRealTotal"] = 0.0;
    }
}


<div class="sidebar_test">

    عدد مواعيد اليوم : @ViewData["noApts"]
    <br />
    مجموع الدخل :
    @Math.Ceiling(((double)ViewData["todayRealTotal"]))
    @{
        double sum = 0;
        double per = 0;
        if (ViewData["todayFullTotal"] != null && ViewData["todayRealTotal"] != null)
        {
            sum = ((double)ViewData["todayFullTotal"]) - ((double)ViewData["todayRealTotal"]);
            per = (sum / ((double)ViewData["todayRealTotal"])) * 100;
        }

    }
    <br />
    مبلغ الخضم :
    @sum
    <br />
    نسبة الخضم :
    @per.ToString("0.00") %
</div>

<div class="sidebar_test">

    عدد مواعيد أمس : @ViewData["noAptsYes"]
    <br />
    مجموع الدخل :
    @Math.Ceiling(((double)ViewData["yesterdayRealTotal"]))

    @{
        sum = 0;
        per = 0;
        if (ViewData["yesterdayRealTotal"] != null && ViewData["yesterdayFullTotal"] != null)
        {
            sum = ((double)ViewData["yesterdayFullTotal"]) - ((double)ViewData["yesterdayRealTotal"]);
            per = (sum / ((double)ViewData["yesterdayRealTotal"])) * 100;
        }

    }
    <br />
    مبلغ الخضم :
    @sum
    <br />
    نسبة الخضم :
    @per.ToString("0.00") %

</div>

<h1>دخل المعالجين اليوم</h1>
<canvas id="docs" height="300" width="600"></canvas>
<div>
      @{ int i = 1;
         var list = ViewData["todayDocs"];
         String coma = ", ";
         String q = "\"";
         }
    
       @if (list != null )
       {
           

           
               <script>

                   var barChartData2 = {
                       labels: [

                       @foreach( var item2 in Model.today)
                   {

                       
                           if(i++ !=1 )
                           {
                                @coma
                           }
                                                      @Html.Raw(q)
                        @item2.name
                       @Html.Raw(q)
                       
                   }
                       
                       ] ,
            @{
           i = 0;
            }
            datasets: [
                {
                    fillColor: "rgba(220,220,220,0.5)",
                    strokeColor: "rgba(220,220,220,1)",
                    data: [
                                        @foreach( var item2 in Model.today)
            {
                if (i++ != 0)
                {

                    
                    @coma
                                        }
                 @item2.total 
                
                       
            } ]    
                }
            ]

        }

        var myLine2 = new Chart(document.getElementById("docs").getContext("2d")).Bar(barChartData2);

    </script>



  
            }
       
       

            
            
            
             




</div>





<h1>دخل المعالجين لهذا الشهر</h1>
<canvas id="mdocs" height="300" width="600"></canvas>
<div>
    @{ 
     i = 1;
     list = ViewData["monthDocs"];
     coma = ", ";
     q = "\"";
    }

    @if (list != null)
    {



        <script>

                   var barChartData2 = {
                       labels: [

                       @foreach( var item2 in Model.yesterday)
                   {


                           if(i++ !=1 )
                           {
                                @coma
                           }
                                                      @Html.Raw(q)
                        @item2.name
                       @Html.Raw(q)

                   }

                       ] ,
            @{
           i = 0;
            }
            datasets: [
                {
                    fillColor: "rgba(220,220,220,0.5)",
                    strokeColor: "rgba(220,220,220,1)",
                    data: [
                                        @foreach (var item2 in Model.yesterday)
            {
                if (i++ != 0)
                {


                    @coma
                                        }
                 @item2.total


            } ]
                }
            ]

        }

        var myLine2 = new Chart(document.getElementById("mdocs").getContext("2d")).Bar(barChartData2);

        </script>




    }











</div>

